/*
 * MesoscopicTrafficSimulation.h
 *
 *  Created on: 12/10/2011
 *      Author: godinho
 */

#ifndef MESOSCOPICTRAFFICSIMULATION_H_
#define MESOSCOPICTRAFFICSIMULATION_H_

#include <evolutive/LifeSimulator.h>
#include <SimulatorOutput.h>

class Controller;
class Network;

class MesoscopicTrafficSimulation : public LifeSimulator {
public:
	MesoscopicTrafficSimulation();
	virtual ~MesoscopicTrafficSimulation();

	virtual void simulate(std::vector<Case*> cases, LocalView* net);

	virtual void stopSimulation();

	class SimulationInterfaceImpl : public SimulatorOutput {
	public:
		SimulationInterfaceImpl();
		~SimulationInterfaceImpl();
		virtual void startSimulation(Network* network);
		virtual void endSimulation(Network* network);
		virtual void startStep(int step, Network* network);
		virtual void endStep(int step, Network* network);
	};

private:
	Network* buildSimulationEnvirionment(LocalView* lv);

	int calculateTravelTime(Node* n1, Node* n2);

	void buildPhases(Node* n, Network* net);

private:
	Controller* mControler;
	SimulatorOutput* mSimulationInterface;
};

#endif /* MESOSCOPICTRAFFICSIMULATION_H_ */
